'======================================
' StringNextTable
'======================================
Private Sub test_SimpleStrNextTable_str()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "aAcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    Debug.Assert nextTable.Str = "aAcd"
End Sub

Private Sub test_SimpleStrNextTable_Length()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "abcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    Debug.Assert nextTable.Length = 4
End Sub

Private Sub test_SimpleStrNextTable_startWith()
    Dim snt1 As SimpleStrNextTable
    Set snt1 = New SimpleStrNextTable
    snt1.Init "abCd"

    Dim snt2 As SimpleStrNextTable
    Set snt2 = New SimpleStrNextTable
    snt2.Init "abC"

    Dim snt3 As SimpleStrNextTable
    Set snt3 = New SimpleStrNextTable
    snt3.Init "abc"

    Dim nt1 As IStringNextTable
    Set nt1 = snt1
    Dim nt2 As IStringNextTable
    Set nt2 = snt2
    Dim nt3 As IStringNextTable
    Set nt3 = snt3

    Debug.Assert nt1.startWith(nt2) = True
    Debug.Assert nt1.startWith(nt3) = False

    '----------------------------------------------
    Dim icnt1 As IgnoreCaseStrNextTable
    Set icnt1 = New IgnoreCaseStrNextTable
    icnt1.Init "aBc"
    Debug.Assert nt1.startWith(icnt1) = True
End Sub

Private Sub test_SimpleStrNextTable_startWithStr()
    Dim snt1 As SimpleStrNextTable
    Set snt1 = New SimpleStrNextTable
    snt1.Init "abCd"

    Dim nt1 As IStringNextTable
    Set nt1 = snt1

    Debug.Assert nt1.startwithStr("abC") = True
    Debug.Assert nt1.startwithStr("abc") = False
End Sub

Private Sub test_SimpleStrNextTable_getActiveChar()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "aBcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.setActiveIndex (1)
    Debug.Assert nextTable.getActiveChar() = "B"
    Debug.Assert nextTable.getActiveChar() <> "b"
    nextTable.setActiveIndex (2)
    Debug.Assert nextTable.getActiveChar() = "c"
End Sub

Private Sub test_SimpleStrNextTable_setActiveChar()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "abcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.setActiveIndex (2)
    Debug.Assert nextTable.getActiveChar() = "c"
End Sub

Private Sub test_SimpleStrNextTable_toNextActiveIndex()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "abcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.setActiveIndex (2)
    nextTable.toNextActiveIndex
    Debug.Assert nextTable.ActiveIndex = 3
End Sub

Private Sub test_SimpleStrNextTable_isWholeMatched()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "aaBaac"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.matchChar "a"
    nextTable.matchChar "a"
    nextTable.matchChar "B"
    nextTable.matchChar "a"
    nextTable.matchChar "a"
    nextTable.matchChar "B"
    Debug.Assert nextTable.isWholeMatched = False

    nextTable.matchChar "a"
    nextTable.matchChar "a"
    nextTable.matchChar "c"
    Debug.Assert nextTable.isWholeMatched = True
End Sub

Private Sub test_SimpleStrNextTable_reset()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "abcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.setActiveIndex (2)
    Debug.Assert nextTable.ActiveIndex = 2

    nextTable.reset
    Debug.Assert nextTable.ActiveIndex = 0
End Sub

Private Sub test_SimpleStrNextTable_equalActiveChar()
    Dim simpleNextTable As SimpleStrNextTable
    Set simpleNextTable = New SimpleStrNextTable
    simpleNextTable.Init "abcd"

    Dim nextTable As IStringNextTable
    Set nextTable = simpleNextTable

    nextTable.setActiveIndex (2)
    Debug.Assert nextTable.equalActiveChar("c") = True
    Debug.Assert nextTable.equalActiveChar("C") = False
End Sub

